package com.wty.cmims.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.wty.cmims.pojo.Code;
import com.wty.cmims.pojo.MedicalHistory;
import com.wty.cmims.pojo.ResponseResult;
import com.wty.cmims.service.MedicalHistoryService;
import com.wty.cmims.mapper.MedicalHistoryMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
* @author wty
* @description 针对表【medical_history】的数据库操作Service实现
* @createDate 2024-10-13 17:41:10
*/
@Service
public class MedicalHistoryServiceImpl extends ServiceImpl<MedicalHistoryMapper, MedicalHistory>
    implements MedicalHistoryService{
    @Autowired
    private MedicalHistoryMapper medicalHistoryMapper;
    @Override
    public ResponseResult<Map<String, Object>> medicalHistoryfind(Integer appointmentId) {
        ResponseResult<Map<String, Object>> responseResult = new ResponseResult<>();
        Map<String, Object> medicalHistory = medicalHistoryMapper.findMedicalHistory(appointmentId);
        if (!medicalHistory.isEmpty()){
            responseResult.setCode(Code.SUCCESS);
            responseResult.setMessage("病历信息获取成功");
            responseResult.setData(medicalHistory);
        } else {
            responseResult.setCode(Code.ERROR);
            responseResult.setMessage("病历信息获取失败");
        }
        return responseResult;
    }
}




